<template>
<div>
  <HelloWorld></HelloWorld>
  <HomeSwiper :list="swiperList"></HomeSwiper>
  <HomeIcons :list="iconsList"></HomeIcons>
  <HomeRecommend :list="RecommendList"></HomeRecommend>
</div>
</template>

<script>
import HelloWorld from './components/HelloWorld'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/icons'
import HomeRecommend from './components/Recommend'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HelloWorld,
    HomeSwiper,
    HomeIcons,
    HomeRecommend
  },
  data () {
    return {
      swiperList: [],
      iconsList: [],
      RecommendList: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      if (res.ret && res.data) {
        const data = res.data
        this.city = data.city
        this.swiperList = data.swiperList
        this.iconsList = data.iconsList
        this.RecommendList = data.RecommendList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>

<style>
</style>
